import 'package:boss/provider/table_provider.dart';
import 'package:boss/ui/page/tableManagement/page/plusBatchTable/provider/plus_batch_table_provider.dart';
import 'package:boss/ui/widget/button/fixed_bottom_btn.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class PlusBatchTableFooter extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return FixedBottomBtn(
      title: '保 存',
      onTap: () => _plusBatchStoreTable(context),
      isShowShadow: false,
    );
  }

  _plusBatchStoreTable(BuildContext context) async {
    var plusBatchTableProvider = Provider.of<PlusBatchTableProvider>(
      context,
      listen: false,
    );
    var tableProvider = Provider.of<TableProvider>(
      context,
      listen: false,
    );
    var result = await tableProvider.plusBatchStoreTable(plusBatchTableProvider.batchTable);
    if (result) Navigator.pop(context);
  }
}
